#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<unordered_map>
#include<unordered_set>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 1e3 + 10;
int a[N];
vector<int> b[N];
void solve()
{
     int n,m;
     cin >> n >> m;
     int t = n / m ;
     for(int i = 1; i <= n; i++)
     {
         cin >> a[i];
         b[a[i]].push_back(i); 
     }
    for(int i = 1; i <= t; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            cout << b[j][i-1] << endl;
        }
    }
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t = 1;
    while(t--) solve();
    return 0;
}